﻿using Entity.AI.DTO;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Service.AI;

namespace AnQinManagermentBackendAPI.Controller.AI
{
    /// <summary>
    /// AI控制器
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    //[Authorize]
    public class AIController : ControllerBase
    {
        /**
         * AI业务接口
         */
        private readonly AIService _aIService;

        /**
         * 构造函数注入
         */
        public AIController(AIService aIService)
        {
            _aIService = aIService;
        }

        /// <summary>
        /// 获取模型信息
        /// </summary>
        [HttpGet]
        public async Task<IActionResult> GetModelHealth()
        {
            var response = await _aIService.GetModelHealth();
            return StatusCode(response.Status, response);
        }

        /// <summary>
        /// 发送信息给模型
        /// </summary>
        /// <params name="aIRequestChat"></params>
        [HttpPost]
        public async Task<IActionResult> PostModelChat([FromBody] AIRequestChat aIRequestChat)
        {
            var response = await _aIService.PostModelChat(aIRequestChat);
            return StatusCode(response.Status, response);
        }
    }
}
